package com.ht;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;

import java.net.InetAddress;
import java.net.UnknownHostException;

@Slf4j
@EnableDiscoveryClient
@SpringBootApplication
public class GatewayServerApplication {

    public static void main(String[] args) throws UnknownHostException {
        ConfigurableApplicationContext application = SpringApplication.run(GatewayServerApplication.class, args);
        Environment env = application.getEnvironment();
        String ip = InetAddress.getLocalHost().getHostAddress();
        String port = env.getProperty("server.port");
        String path = env.getProperty("server.servlet.context-path");
        log.info("\n----------------------------------------------------------\n\tApplication is running! Access URLs:\n\tLocal: \t\thttp://localhost:{}{}/\n\tExternal: \thttps://{}:{}{}/\n\tswagger-ui: \thttps://{}:{}{}/swagger-ui.html\n\tDoc: \t\thttps://{}:{}{}/doc.html\n----------------------------------------------------------", port, path, ip, port, path, ip, port, path, ip, port, path);
    }

}
